﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business.DwzFrame;
using NHibernate;
using ZLCMS.Business;
using DotNet.Common.NHibernateUtil;

namespace ZLCMS.Web.SystemManage.Basics.TypeList
{
    public partial class Delete : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            FrameHelper framePage = new FrameHelper(this);

            using(ISession session = DotNet.Common.NHibernateUtil.SessionFactoryHelper.CreateSession())
            {
                if (Request["ajax"] == "dels")
                {
                    String ids = Request["ids"];
                    if (!String.IsNullOrEmpty(ids))
                    {
                        String[] array = ids.Split(',');
                        session.CreateQuery("delete from CmsTreeDef where Id in (:array)").SetParameterList("array", array).ExecuteUpdate();
                    }
                }
                else if (!String.IsNullOrEmpty(Request["uid"]))
                {
                    session.CreateQuery("delete from CmsTreeDef where Id=" + Request["uid"]).ExecuteUpdate();
                }
            }
  
            framePage.Alert(new ReturnCode() { statusCode = 200, message = "操作成功!", navTabId = framePage.NavTabId });
        }
    }
}
